<?php

namespace app\admin\model\pointgoods;

use think\Model;


class PointGoodsOrdersDetail extends Model
{

    

    

    // 表名
    protected $name = 'point_goods_orders_detail';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'assess_text'
    ];
    

    
    public function getAssessList()
    {
        return ['1' => __('Assess 1'), '2' => __('Assess 2')];
    }


    public function getAssessTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['assess']) ? $data['assess'] : '');
        $list = $this->getAssessList();
        return isset($list[$value]) ? $list[$value] : '';
    }
	
	function goods()
	{
		return $this->belongsTo(PointGoods::class,'goods_id');
	}
	
	function spec()
	{
		return $this->belongsTo(PointGoodsSpec::class,'spec_id');
	}
	
	
	
	
}
